<template>
  <div class="mui-numbox" data-numbox-min="1">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input
      class="mui-input-numbox"
      type="number"
      @change="getCount"
      ref="num"
      :value="initcount"
    />
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>

<script>
import mui from "../../lib/mui/js/mui.min.js";
export default {
  mounted() {
    mui(".mui-numbox").numbox();
  },
  props: ["initcount", "id"],
  methods: {
    getCount() {
      let data = { id: this.id, count: parseInt(this.$refs.num.value) };
      this.$store.commit("updateGoodsFromCar", data);
    },
  },
};
</script>

<style>
</style>